import Login from './pages/login/Login'
import Home from './pages/home/Home'
import './App.css'
import { storage } from './api/local'
import type { JSX } from 'react'


function App() {

  if (window.location.pathname != '/login' && !storage.get('token')) {
    window.location.pathname = '/login'
  }
  const routeMap: Record<string, JSX.Element> = {
    '/': <Home />,
    '/home': <Home />,
  }

  return routeMap[window.location.pathname] || <Login />
}

export default App
